"use strict";

function uuid() {
  for (var e = [], t = "0123456789abcdef", a = 0; a < 36; a++) {
    e[a] = t.substr(Math.floor(16 * Math.random()), 1);
  }e[14] = "4", e[19] = t.substr(3 & e[19] | 8, 1), e[8] = e[13] = e[18] = e[23] = "-";var o = e.join("");return new Date().getTime() + "-" + o;
}$("form button").click(function () {
  if ("扫码登录" == $(this).text().replace(/\s/g, "")) {
    var e = uuid();$("#saomaImg").text(""), jQuery("#saomaImg").qrcode({ render: "canvas", foreground: "#000", background: "#FFF", text: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx5a9db0b452e8ca0b&redirect_uri=http://kg.zhaodashen.cn/mt/web/qr/login.jsp&response_type=code&scope=snsapi_base&state=" + e + "&connect_redirect=1#wechat_redirect" });var t = io("http://39.107.231.173:3001");t.emit("join", e), t.on("islogin", function (e) {
      200 === e.meta.state && ($.message({ message: "登录成功", type: "success" }), sessionStorage.setItem("token", e.data.token), sessionStorage.setItem("uname", e.data.uname), sessionStorage.setItem("avatar", e.data.avatar), setTimeout(function () {
        location.href = "./index.html";
      }, 2e3));
    });
  }
});